﻿using Kugar.MVC.MobileUI.WeUI.Enum;

namespace Kugar.MVC.MobileUI.WeUI.PageControls.PageCommons
{
    public class ButtonItemBase
    {
        //private TagAttrbute _attrs=new TagAttrbute();

        internal ButtonStyleType _styleType = ButtonStyleType.Default;
        internal string _clickScript = "";
        internal string _text = "";
        internal string _css = "";
        internal ButtonTypeEnum _type = ButtonTypeEnum.Button;
        internal string _href = "";
        internal string _data = "";

        protected TagAttrbute _attrs=new TagAttrbute();


        internal ButtonStyleType getButtonStyle => _styleType;

        internal string getOnClickScript => _clickScript;

        internal string getText => _text;

        internal string getID => _attrs.GetValue("id","");

        internal string getClass => _css;

        internal ButtonTypeEnum getType => _type;

        public virtual ButtonItemBase ButtonStyle(ButtonStyleType style) 
        {
            _styleType = style;

            return this;
        }

        public virtual ButtonItemBase OnClick(string script) 
        {
            _clickScript = script;

            return this;
        }

        public virtual ButtonItemBase Text(string text)
        {
            _text = text;

            return this;
        }

        public virtual ButtonItemBase Href(string gotoUrl)
        {
            _href = gotoUrl;

            return this;
        }

        public virtual ButtonItemBase Type(ButtonTypeEnum type)
        {
            _type = type;

            return this;
        }

        public virtual ButtonItemBase ID(string id)
        {
            _attrs.ID(id);

            return this;
        }

        public virtual ButtonItemBase Class(string css)
        {
            _attrs.Class(css);
            
            return this;
        }
        
        public virtual ButtonItemBase Data(string dataName, string value)
        {
            _attrs.Data(dataName, value);
            
            return this;
        }

        public TagAttrbute Attributes => _attrs;

        internal string getHref => _href;
    }
}